home *** CD-ROM | disk | FTP | other *** search
- Path: news.ios.com!usenet
- From: John Leonard <leonardj@tribeca.ios.com>
- Newsgroups: comp.lang.c++
- Subject: Include file conflicts in BC++ 4.52
- Date: Wed, 24 Jan 1996 14:17:36 -0500
- Organization: 12th of Nov, Inc
- Message-ID: <310685D0.381D@tribeca.ios.com>
- NNTP-Posting-Host: ppp-52.ts-9.hck.idt.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b4 (Win95; I)
-
- I am using BC++ 4.52. A program I just compiled included "string.h" and "windowsx.h". Both of
- these files make some common defines:
-
- from string.h
-
- #if !defined(__STDC__) /* NON_ANSI */
- #define _fmemccpy memccpy
- #define _fmemchr memchr
- #define _fmemcmp memcmp
- #define _fmemcpy memcpy
- #define _fmemicmp memicmp
- ...
-
- from windowsx.h
-
- #if !defined(__BORLANDC__)
-
- #define _ncalloc calloc
- #define _nexpand _expand
- #define _ffree free
- #define _fmalloc malloc
- #define _fmemccpy _memccpy
- #define _fmemchr memchr
- #define _fmemcmp memcmp
- #define _fmemcpy memcpy
- #define _fmemicmp _memicmp
- #define _fmemmove memmove
- #define _fmemset memset
- ...
-
- This produced an error. I tried to change this by routing the compiler around the code block in
- the windowsx file by placing the string "__BORLANDC__" in the defines box in the
- Options/Project/defines dialog. This produced another error relating to a different definition of
- that string i.e. "__BORLANDC__" , in, I think, the "new.h" file. So I removed the __BORLANDC__ from
- the defines list and made the following change to the windowsx file itself:
-
- // #if !defined(__BORLANDC__)
- #if 0
-
- #define _ncalloc calloc
- #define _nexpand _expand
- ...
-
- As far as I can tell this solved the problem and allowed me to build and run the prog. What I
- want to know is, what is the correct way of doing this? Isn't __BORLANDC__ defined automatically by
- the environment, why isn't windowsx.h being routed around that #define block? I mean why should
- including standard header files like string.h and windowsx.h cause a conflict? Earlier I tried
- including, I think it was "user.h", so that my window function could use some API define like
- SW_SHOWDEFAULT and that caused problems. I didn't even want to deal with it. I just copied the
- #define out of the file and into my own source and got it to compile but surely that is not the way
- to do things.
- Thanks,
- John
-